﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace RESTester
{
    public static class Ext
    {
        public static List<HTTPHeader> GetParsedHeaders(this WebHeaderCollection headers)
        {
            List<HTTPHeader> result = new List<HTTPHeader>();

            if (headers != null)
            {
                for (int i = 0; i < headers.Count; i++)
                {
                    String name = headers.GetKey(i);
                    String values = String.Join(",", headers.GetValues(name));

                    result.Add(new HTTPHeader { Name = name, Value = values });
                }
            }

            return result;
        }
    }
}
